#ifndef DATASHEET_H
#define DATASHEET_H
#include <QApplication>
#include <QObject>
#include <QTableWidget>
#include <QStringList>
#include <QTableWidgetItem>
#include <QTableWidgetSelectionRange>
#include <QAction>
#include <QList>
#include <QDebug>
#include <QClipboard>
class DataSheet : public QTableWidget
{
    Q_OBJECT
public:
    int Width = 120,Height = 160;
    explicit DataSheet(QWidget *parent = 0);
    void setDataItem(int x,int y,int n,int k)//x行y列的第n场数据设为k
    {
        tableData[x][y][n]=k;
    }
    void setScale(int tWidth,int tHeight)
    {
        this->Width = tWidth;
        this->Height = tHeight;
    }

    void showDataItem(int n)
    {
        for (int i=0;i<2*Height;i++)
            for (int j=0;j<13;j++)
            {
                if (tableData[i][j][n]==0)
                    dataItem[i][j]->setText(QString(""));
                else
                    dataItem[i][j]->setText(QString::number(tableData[i][j][n]));
            }
    }
    void changeDataItem(int x,int y,int k)
    {

        if (k==0)
            dataItem[x][y]->setText("");
        else
            dataItem[x][y]->setText(QString::number(k));
    }

signals:
private:
    QClipboard *clicpboard;
    QAction *copyMenu;
    QList<QTableWidgetItem*> copyItem;
    QList<QTableWidgetSelectionRange> copyRange;
    static unsigned short int tableData[241][13][100000];
    QTableWidgetItem *dataItem[485][13];//120行，13列
public slots:
    void copy();
};

#endif // DATASHEET_H
